
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Lookup API reference &#8212; Django 2.2.12.dev20200304094918 documentation</title>
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Query Expressions" href="expressions.html" />
    <link rel="prev" title="QuerySet API reference" href="querysets.html" />



 
<script type="text/javascript" src="../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);</script>

  </head><body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../index.html">Django 2.2.12.dev20200304094918 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../index.html">Home</a>  |
        <a title="Table of contents" href="../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../genindex.html">Index</a>  |
        <a title="Module index" href="../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="querysets.html" title="&lt;code class=&#34;docutils literal notranslate&#34;&gt;&lt;span class=&#34;pre&#34;&gt;QuerySet&lt;/span&gt;&lt;/code&gt; API reference">previous</a>
     |
    <a href="../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="expressions.html" title="Query Expressions">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-models-lookups">
            
  <div class="section" id="s-module-django.db.models.lookups">
<span id="s-lookup-api-reference"></span><span id="module-django.db.models.lookups"></span><span id="lookup-api-reference"></span><h1>Lookup API reference<a class="headerlink" href="#module-django.db.models.lookups" title="Permalink to this headline">¶</a></h1>
<p>This document has the API references of lookups, the Django API for building
the <code class="docutils literal notranslate"><span class="pre">WHERE</span></code> clause of a database query. To learn how to <em>use</em> lookups, see
<a class="reference internal" href="../../topics/db/queries.html"><span class="doc">Making queries</span></a>; to learn how to <em>create</em> new lookups, see
<a class="reference internal" href="../../howto/custom-lookups.html"><span class="doc">Custom Lookups</span></a>.</p>
<p>The lookup API has two components: a <a class="reference internal" href="#django.db.models.lookups.RegisterLookupMixin" title="django.db.models.lookups.RegisterLookupMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">RegisterLookupMixin</span></code></a> class
that registers lookups, and the <a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>, a
set of methods that a class has to implement to be registrable as a lookup.</p>
<p>Django has two base classes that follow the query expression API and from where
all Django builtin lookups are derived:</p>
<ul class="simple">
<li><a class="reference internal" href="#django.db.models.Lookup" title="django.db.models.Lookup"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lookup</span></code></a>: to lookup a field (e.g. the <code class="docutils literal notranslate"><span class="pre">exact</span></code> of <code class="docutils literal notranslate"><span class="pre">field_name__exact</span></code>)</li>
<li><a class="reference internal" href="#django.db.models.Transform" title="django.db.models.Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a>: to transform a field</li>
</ul>
<p>A lookup expression consists of three parts:</p>
<ul class="simple">
<li>Fields part (e.g. <code class="docutils literal notranslate"><span class="pre">Book.objects.filter(author__best_friends__first_name...</span></code>);</li>
<li>Transforms part (may be omitted) (e.g. <code class="docutils literal notranslate"><span class="pre">__lower__first3chars__reversed</span></code>);</li>
<li>A lookup (e.g. <code class="docutils literal notranslate"><span class="pre">__icontains</span></code>) that, if omitted, defaults to <code class="docutils literal notranslate"><span class="pre">__exact</span></code>.</li>
</ul>
<div class="section" id="s-registration-api">
<span id="s-lookup-registration-api"></span><span id="registration-api"></span><span id="lookup-registration-api"></span><h2>Registration API<a class="headerlink" href="#registration-api" title="Permalink to this headline">¶</a></h2>
<p>Django uses <a class="reference internal" href="#django.db.models.lookups.RegisterLookupMixin" title="django.db.models.lookups.RegisterLookupMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">RegisterLookupMixin</span></code></a> to give a class the interface to
register lookups on itself. The two prominent examples are
<a class="reference internal" href="fields.html#django.db.models.Field" title="django.db.models.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">Field</span></code></a>, the base class of all model fields, and
<a class="reference internal" href="#django.db.models.Transform" title="django.db.models.Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a>, the base class of all Django transforms.</p>
<dl class="class">
<dt id="django.db.models.lookups.RegisterLookupMixin">
<em class="property">class </em><code class="descclassname">lookups.</code><code class="descname">RegisterLookupMixin</code><a class="headerlink" href="#django.db.models.lookups.RegisterLookupMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>A mixin that implements the lookup API on a class.</p>
<dl class="classmethod">
<dt id="django.db.models.lookups.RegisterLookupMixin.register_lookup">
<em class="property">classmethod </em><code class="descname">register_lookup</code>(<em>lookup</em>, <em>lookup_name=None</em>)<a class="headerlink" href="#django.db.models.lookups.RegisterLookupMixin.register_lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>Registers a new lookup in the class. For example
<code class="docutils literal notranslate"><span class="pre">DateField.register_lookup(YearExact)</span></code> will register <code class="docutils literal notranslate"><span class="pre">YearExact</span></code>
lookup on <code class="docutils literal notranslate"><span class="pre">DateField</span></code>. It overrides a lookup that already exists with
the same name. <code class="docutils literal notranslate"><span class="pre">lookup_name</span></code> will be used for this lookup if
provided, otherwise <code class="docutils literal notranslate"><span class="pre">lookup.lookup_name</span></code> will be used.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.lookups.RegisterLookupMixin.get_lookup">
<code class="descname">get_lookup</code>(<em>lookup_name</em>)<a class="headerlink" href="#django.db.models.lookups.RegisterLookupMixin.get_lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the <a class="reference internal" href="#django.db.models.Lookup" title="django.db.models.Lookup"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lookup</span></code></a> named <code class="docutils literal notranslate"><span class="pre">lookup_name</span></code> registered in the class.
The default implementation looks recursively on all parent classes
and checks if any has a registered lookup named <code class="docutils literal notranslate"><span class="pre">lookup_name</span></code>, returning
the first match.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.lookups.RegisterLookupMixin.get_lookups">
<code class="descname">get_lookups</code>()<a class="headerlink" href="#django.db.models.lookups.RegisterLookupMixin.get_lookups" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a dictionary of each lookup name registered in the class mapped
to the <a class="reference internal" href="#django.db.models.Lookup" title="django.db.models.Lookup"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lookup</span></code></a> class.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.lookups.RegisterLookupMixin.get_transform">
<code class="descname">get_transform</code>(<em>transform_name</em>)<a class="headerlink" href="#django.db.models.lookups.RegisterLookupMixin.get_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a <a class="reference internal" href="#django.db.models.Transform" title="django.db.models.Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a> named <code class="docutils literal notranslate"><span class="pre">transform_name</span></code>. The default
implementation looks recursively on all parent classes to check if any
has the registered transform named <code class="docutils literal notranslate"><span class="pre">transform_name</span></code>, returning the first
match.</p>
</dd></dl>

</dd></dl>

<p>For a class to be a lookup, it must follow the <a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>. <a class="reference internal" href="#django.db.models.Lookup" title="django.db.models.Lookup"><code class="xref py py-class docutils literal notranslate"><span class="pre">Lookup</span></code></a> and <a class="reference internal" href="#django.db.models.Transform" title="django.db.models.Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a> naturally
follow this API.</p>
</div>
<div class="section" id="s-the-query-expression-api">
<span id="s-query-expression"></span><span id="the-query-expression-api"></span><span id="query-expression"></span><h2>The Query Expression API<a class="headerlink" href="#the-query-expression-api" title="Permalink to this headline">¶</a></h2>
<p>The query expression API is a common set of methods that classes define to be
usable in query expressions to translate themselves into SQL expressions. Direct
field references, aggregates, and <code class="docutils literal notranslate"><span class="pre">Transform</span></code> are examples that follow this
API. A class is said to follow the query expression API when it implements the
following methods:</p>
<dl class="method">
<dt id="django.db.models.as_sql">
<code class="descname">as_sql</code>(<em>compiler</em>, <em>connection</em>)<a class="headerlink" href="#django.db.models.as_sql" title="Permalink to this definition">¶</a></dt>
<dd><p>Responsible for producing the query string and parameters for the expression.
The <code class="docutils literal notranslate"><span class="pre">compiler</span></code> is an <code class="docutils literal notranslate"><span class="pre">SQLCompiler</span></code> object, which has a <code class="docutils literal notranslate"><span class="pre">compile()</span></code>
method that can be used to compile other expressions. The <code class="docutils literal notranslate"><span class="pre">connection</span></code> is
the connection used to execute the query.</p>
<p>Calling <code class="docutils literal notranslate"><span class="pre">expression.as_sql()</span></code> is usually incorrect - instead
<code class="docutils literal notranslate"><span class="pre">compiler.compile(expression)</span></code> should be used. The <code class="docutils literal notranslate"><span class="pre">compiler.compile()</span></code>
method will take care of calling vendor-specific methods of the expression.</p>
<p>Custom keyword arguments may be defined on this method if it’s likely that
<code class="docutils literal notranslate"><span class="pre">as_vendorname()</span></code> methods or subclasses will need to supply data to
override the generation of the SQL string. See <a class="reference internal" href="expressions.html#django.db.models.Func.as_sql" title="django.db.models.Func.as_sql"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Func.as_sql()</span></code></a> for
example usage.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.as_vendorname">
<code class="descname">as_vendorname</code>(<em>compiler</em>, <em>connection</em>)<a class="headerlink" href="#django.db.models.as_vendorname" title="Permalink to this definition">¶</a></dt>
<dd><p>Works like <code class="docutils literal notranslate"><span class="pre">as_sql()</span></code> method. When an expression is compiled by
<code class="docutils literal notranslate"><span class="pre">compiler.compile()</span></code>, Django will first try to call <code class="docutils literal notranslate"><span class="pre">as_vendorname()</span></code>,
where <code class="docutils literal notranslate"><span class="pre">vendorname</span></code> is the vendor name of the backend used for executing
the query. The <code class="docutils literal notranslate"><span class="pre">vendorname</span></code> is one of <code class="docutils literal notranslate"><span class="pre">postgresql</span></code>, <code class="docutils literal notranslate"><span class="pre">oracle</span></code>,
<code class="docutils literal notranslate"><span class="pre">sqlite</span></code>, or <code class="docutils literal notranslate"><span class="pre">mysql</span></code> for Django’s built-in backends.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.get_lookup">
<code class="descname">get_lookup</code>(<em>lookup_name</em>)<a class="headerlink" href="#django.db.models.get_lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>Must return the lookup named <code class="docutils literal notranslate"><span class="pre">lookup_name</span></code>. For instance, by returning
<code class="docutils literal notranslate"><span class="pre">self.output_field.get_lookup(lookup_name)</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.get_transform">
<code class="descname">get_transform</code>(<em>transform_name</em>)<a class="headerlink" href="#django.db.models.get_transform" title="Permalink to this definition">¶</a></dt>
<dd><p>Must return the lookup named <code class="docutils literal notranslate"><span class="pre">transform_name</span></code>. For instance, by returning
<code class="docutils literal notranslate"><span class="pre">self.output_field.get_transform(transform_name)</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.output_field">
<code class="descname">output_field</code><a class="headerlink" href="#django.db.models.output_field" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the type of class returned by the <code class="docutils literal notranslate"><span class="pre">get_lookup()</span></code> method. It must
be a <a class="reference internal" href="fields.html#django.db.models.Field" title="django.db.models.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">Field</span></code></a> instance.</p>
</dd></dl>

</div>
<div class="section" id="s-transform-reference">
<span id="transform-reference"></span><h2><code class="docutils literal notranslate"><span class="pre">Transform</span></code> reference<a class="headerlink" href="#transform-reference" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="django.db.models.Transform">
<em class="property">class </em><code class="descname">Transform</code><a class="reference internal" href="../../_modules/django/db/models/lookups.html#Transform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.models.Transform" title="Permalink to this definition">¶</a></dt>
<dd><p>A <code class="docutils literal notranslate"><span class="pre">Transform</span></code> is a generic class to implement field transformations. A
prominent example is <code class="docutils literal notranslate"><span class="pre">__year</span></code> that transforms a <code class="docutils literal notranslate"><span class="pre">DateField</span></code> into a
<code class="docutils literal notranslate"><span class="pre">IntegerField</span></code>.</p>
<p>The notation to use a <code class="docutils literal notranslate"><span class="pre">Transform</span></code> in an lookup expression is
<code class="docutils literal notranslate"><span class="pre">&lt;expression&gt;__&lt;transformation&gt;</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">date__year</span></code>).</p>
<p>This class follows the <a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>, which
implies that you can use <code class="docutils literal notranslate"><span class="pre">&lt;expression&gt;__&lt;transform1&gt;__&lt;transform2&gt;</span></code>. It’s
a specialized <a class="reference internal" href="expressions.html#func-expressions"><span class="std std-ref">Func() expression</span></a> that only accepts
one argument.  It can also be used on the right hand side of a filter or
directly as an annotation.</p>
<dl class="attribute">
<dt id="django.db.models.Transform.bilateral">
<code class="descname">bilateral</code><a class="headerlink" href="#django.db.models.Transform.bilateral" title="Permalink to this definition">¶</a></dt>
<dd><p>A boolean indicating whether this transformation should apply to both
<code class="docutils literal notranslate"><span class="pre">lhs</span></code> and <code class="docutils literal notranslate"><span class="pre">rhs</span></code>. Bilateral transformations will be applied to <code class="docutils literal notranslate"><span class="pre">rhs</span></code> in
the same order as they appear in the lookup expression. By default it is set
to <code class="docutils literal notranslate"><span class="pre">False</span></code>. For example usage, see <a class="reference internal" href="../../howto/custom-lookups.html"><span class="doc">Custom Lookups</span></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.Transform.lhs">
<code class="descname">lhs</code><a class="headerlink" href="#django.db.models.Transform.lhs" title="Permalink to this definition">¶</a></dt>
<dd><p>The left-hand side - what is being transformed. It must follow the
<a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.Transform.lookup_name">
<code class="descname">lookup_name</code><a class="headerlink" href="#django.db.models.Transform.lookup_name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the lookup, used for identifying it on parsing query
expressions. It cannot contain the string <code class="docutils literal notranslate"><span class="pre">&quot;__&quot;</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.Transform.output_field">
<code class="descname">output_field</code><a class="headerlink" href="#django.db.models.Transform.output_field" title="Permalink to this definition">¶</a></dt>
<dd><p>Defines the class this transformation outputs. It must be a
<a class="reference internal" href="fields.html#django.db.models.Field" title="django.db.models.Field"><code class="xref py py-class docutils literal notranslate"><span class="pre">Field</span></code></a> instance. By default is the same as
its <code class="docutils literal notranslate"><span class="pre">lhs.output_field</span></code>.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="s-lookup-reference">
<span id="lookup-reference"></span><h2><code class="docutils literal notranslate"><span class="pre">Lookup</span></code> reference<a class="headerlink" href="#lookup-reference" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="django.db.models.Lookup">
<em class="property">class </em><code class="descname">Lookup</code><a class="reference internal" href="../../_modules/django/db/models/lookups.html#Lookup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.models.Lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>A <code class="docutils literal notranslate"><span class="pre">Lookup</span></code> is a generic class to implement lookups. A lookup is a query
expression with a left-hand side, <a class="reference internal" href="#django.db.models.Lookup.lhs" title="django.db.models.Lookup.lhs"><code class="xref py py-attr docutils literal notranslate"><span class="pre">lhs</span></code></a>; a right-hand side,
<a class="reference internal" href="#django.db.models.Lookup.rhs" title="django.db.models.Lookup.rhs"><code class="xref py py-attr docutils literal notranslate"><span class="pre">rhs</span></code></a>; and a <code class="docutils literal notranslate"><span class="pre">lookup_name</span></code> that is used to produce a boolean
comparison between <code class="docutils literal notranslate"><span class="pre">lhs</span></code> and <code class="docutils literal notranslate"><span class="pre">rhs</span></code> such as <code class="docutils literal notranslate"><span class="pre">lhs</span> <span class="pre">in</span> <span class="pre">rhs</span></code> or
<code class="docutils literal notranslate"><span class="pre">lhs</span> <span class="pre">&gt;</span> <span class="pre">rhs</span></code>.</p>
<p>The notation to use a lookup in an expression is
<code class="docutils literal notranslate"><span class="pre">&lt;lhs&gt;__&lt;lookup_name&gt;=&lt;rhs&gt;</span></code>.</p>
<p>This class doesn’t follow the <a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>
since it has <code class="docutils literal notranslate"><span class="pre">=&lt;rhs&gt;</span></code> on its construction: lookups are always the end of
a lookup expression.</p>
<dl class="attribute">
<dt id="django.db.models.Lookup.lhs">
<code class="descname">lhs</code><a class="headerlink" href="#django.db.models.Lookup.lhs" title="Permalink to this definition">¶</a></dt>
<dd><p>The left-hand side - what is being looked up. The object must follow
the <a class="reference internal" href="#query-expression"><span class="std std-ref">Query Expression API</span></a>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.Lookup.rhs">
<code class="descname">rhs</code><a class="headerlink" href="#django.db.models.Lookup.rhs" title="Permalink to this definition">¶</a></dt>
<dd><p>The right-hand side - what <code class="docutils literal notranslate"><span class="pre">lhs</span></code> is being compared against. It can be
a plain value, or something that compiles into SQL, typically an
<code class="docutils literal notranslate"><span class="pre">F()</span></code> object or a <code class="docutils literal notranslate"><span class="pre">QuerySet</span></code>.</p>
</dd></dl>

<dl class="attribute">
<dt id="django.db.models.Lookup.lookup_name">
<code class="descname">lookup_name</code><a class="headerlink" href="#django.db.models.Lookup.lookup_name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of this lookup, used to identify it on parsing query
expressions. It cannot contain the string <code class="docutils literal notranslate"><span class="pre">&quot;__&quot;</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.Lookup.process_lhs">
<code class="descname">process_lhs</code>(<em>compiler</em>, <em>connection</em>, <em>lhs=None</em>)<a class="reference internal" href="../../_modules/django/db/models/lookups.html#Lookup.process_lhs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.models.Lookup.process_lhs" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a tuple <code class="docutils literal notranslate"><span class="pre">(lhs_string,</span> <span class="pre">lhs_params)</span></code>, as returned by
<code class="docutils literal notranslate"><span class="pre">compiler.compile(lhs)</span></code>. This method can be overridden to tune how
the <code class="docutils literal notranslate"><span class="pre">lhs</span></code> is processed.</p>
<p><code class="docutils literal notranslate"><span class="pre">compiler</span></code> is an <code class="docutils literal notranslate"><span class="pre">SQLCompiler</span></code> object, to be used like
<code class="docutils literal notranslate"><span class="pre">compiler.compile(lhs)</span></code> for compiling <code class="docutils literal notranslate"><span class="pre">lhs</span></code>. The <code class="docutils literal notranslate"><span class="pre">connection</span></code>
can be used for compiling vendor specific SQL. If <code class="docutils literal notranslate"><span class="pre">lhs</span></code> is not
<code class="docutils literal notranslate"><span class="pre">None</span></code>, use it as the processed <code class="docutils literal notranslate"><span class="pre">lhs</span></code> instead of <code class="docutils literal notranslate"><span class="pre">self.lhs</span></code>.</p>
</dd></dl>

<dl class="method">
<dt id="django.db.models.Lookup.process_rhs">
<code class="descname">process_rhs</code>(<em>compiler</em>, <em>connection</em>)<a class="reference internal" href="../../_modules/django/db/models/lookups.html#Lookup.process_rhs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#django.db.models.Lookup.process_rhs" title="Permalink to this definition">¶</a></dt>
<dd><p>Behaves the same way as <a class="reference internal" href="#django.db.models.Lookup.process_lhs" title="django.db.models.Lookup.process_lhs"><code class="xref py py-meth docutils literal notranslate"><span class="pre">process_lhs()</span></code></a>, for the right-hand side.</p>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../contents.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Lookup API reference</a><ul>
<li><a class="reference internal" href="#registration-api">Registration API</a></li>
<li><a class="reference internal" href="#the-query-expression-api">The Query Expression API</a></li>
<li><a class="reference internal" href="#transform-reference"><code class="docutils literal notranslate"><span class="pre">Transform</span></code> reference</a></li>
<li><a class="reference internal" href="#lookup-reference"><code class="docutils literal notranslate"><span class="pre">Lookup</span></code> reference</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="querysets.html"
                        title="previous chapter"><code class="docutils literal notranslate"><span class="pre">QuerySet</span></code> API reference</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="expressions.html"
                        title="next chapter">Query Expressions</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/ref/models/lookups.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Mar 04, 2020</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="querysets.html" title="&lt;code class=&#34;docutils literal notranslate&#34;&gt;&lt;span class=&#34;pre&#34;&gt;QuerySet&lt;/span&gt;&lt;/code&gt; API reference">previous</a>
     |
    <a href="../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="expressions.html" title="Query Expressions">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>